#include <iostream>
#include <cstdio>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

int main()
{
  pid_t id = fork();
  if(id==0)
  {
    execl("/bin/ls","ls","-l","-a",nullptr);
    exit(1);
  }
  pid_t rid = waitpid(id,nullptr,0);
  if(rid>0)
  {
    printf("等待子进程成功");
  }
  return 0;
}
